﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Segmentation.UI.Forms
{
    public partial class JSEGOptionsForm : Form
    {
        #region Constructors

        public JSEGOptionsForm()
        {
            InitializeComponent();
        }
        
        #endregion Constructors

        #region Properties

        public int ColorThresh
        {
            get
            {
                if (_cbColorThreshAuto.Checked)
                {
                    return -1;
                }
                else
                {
                    return Convert.ToInt32(_nudColorThresh.Value);
                }
            }
        }

        public int NumberOfScales
        {
            get
            {
                if (_cbNumberOfScalesAuto.Checked)
                {
                    return -1;
                }
                else
                {
                    return Convert.ToInt32(_nudNumberOfScales.Value);
                }
            }
        }

        public float RegionMergeThresh
        {
            get
            {
                if (_cbRegionMergeThreshDefault.Checked)
                {
                    return 0.4f;
                }
                else
                {
                    return Convert.ToSingle(_nudRegionMergeThresh.Value);
                }
            }
        }

        #endregion Properties

        #region Check Boxes Checked Changed

        private void _cbColorThreshAuto_CheckedChanged(object sender, EventArgs e)
        {
            _nudColorThresh.ReadOnly = _cbColorThreshAuto.Checked;
        }

        private void _cbRegionMergeThreshDefault_CheckedChanged(object sender, EventArgs e)
        {
            _nudRegionMergeThresh.ReadOnly = _cbRegionMergeThreshDefault.Checked;
        }

        private void _cbNumberOfScalesAuto_CheckedChanged(object sender, EventArgs e)
        {
            _nudNumberOfScales.ReadOnly = _cbNumberOfScalesAuto.Checked;
        }

        #endregion Check Boxes Checked Changed
    }
}
